$(document).ready(function(){

    // Accordion
    $("#accordion").accordion({ header: "h3",autoHeight: false});
    $( "button, input:submit, a", "form" ).button();
    $( "a", "form" ).click(function() { return false; });

    //Forms

    //Join Us form
    $("#join-us").validate({
        submitHandler: function(form) {

          // contact-form ajax
          var sName     = $("#name").val();
          var sLastname = $("#lastname").val();
          var sEmail    = $("#email").val();
          var sMessage  = $("#message").val();

          $.ajax({
              url: "sendData.php",
              context: document.body,
              type: "post",
              data: "name="+sName+"&lastname="+sLastname+"&email="+sEmail+"&message="+sMessage,
              success: function(){
                  $("#join-us-form-container").html('<p class="thanks-message">Thank you for contacting us. We appreciate your interest. We will return your request as soon as we can!</p>');
              }
          });
        }
    });
    //Contact Us form
    $("#contact-us").validate({
            submitHandler: function(form) {

              // contact-form ajax
              var sName     = $("#name2").val();
              var sLastname = $("#lastname2").val();
              var sEmail    = $("#email2").val();
              var sMessage  = $("#message2").val();

              $.ajax({
                  url: "sendData.php",
                  context: document.body,
                  type: "post",
                  data: "name="+sName+"&lastname="+sLastname+"&email="+sEmail+"&message="+sMessage,
                  success: function(){
                      $("#contact-us-form-container").html('<p class="thanks-message">Thank you for contacting us. Your message is very important to us, we will return your request as soon as we can!</p>');
                  }
              });
            }
    });
});	  